home *** CD-ROM | disk | FTP | other *** search
- Path: wolverine.trilogy.com!usenet
- From: "D. Allan Drummond" <allan.drummond@trilogy.com>
- Newsgroups: comp.lang.c++
- Subject: Re: STL and VC 4.0 and namespaces
- Date: Thu, 18 Jan 1996 18:21:57 -0600
- Organization: Trilogy
- Message-ID: <30FEE425.2BEF@trilogy.com>
- References: <30FE67B2.3196@email.usps.gov>
- NNTP-Posting-Host: omnivore.trilogy.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0b3 (WinNT; I)
- CC: cjohnso7@email.usps.gov
-
- Craig Johnson wrote:
- >
- > I just got the book C++ Programmer's Guide to the Standard
- > Template Library, read the first 150 pages, and am trying to
- > used the vector template. I am using Visual C++ 4.0 and I get
- > the following errors.
- >
- > d:\apps32\msdev\stl\iterator.h(65) : warning C4114: same type
- > qualifier used more than once
- > d:\apps32\msdev\stl\defalloc.h(124) : error C2661: 'new' : no
- > overloaded function takes 2 parameters
-
-
- I got the same behavior. The way I solved it is to do this:
-
- #include <new.h>
- namespace std
- {
- #include <vector.h>
- }
-
- This should fix the error (the problem is that the global
- placement new operator is not visible to the defalloc.h file -
- putting <new.h> outside the namespace lets it see it again).
-
- However, I later had to abandon wrapping the STL stuff in the
- std namespace due to problems with ambiguous calls to operator
- != when writing things like this:
-
- vector<char> ch;
- // ...fill ch with stuff...
-
- vector<char>::iterator i( ch.begin() );
- for( ; i != ch.end(); i++ )
- cout << *i;
-
- Has anyone else encountered this type of problem?
-
-
- Allan
-